fix(runtime): redact URL userinfo in command results - #21
Draft
cursor[bot] wants to merge 1 commit into
Draft
Conversation
Playwright page.url() and resolved anchor hrefs preserve basic-auth credentials, which were forwarded to companion/MCP snapshots and errors. Co-authored-by: esadrianno <esadrianno@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug and impact
Playwright preserves URL userinfo (
user:password@host) onpage.url()and resolvedHTMLAnchorElement.href. Companion/MCP forwarded those strings in navigate/click/typeurl, snapshoturl/htmlSnippet/links[].href, andCOMMAND_FAILEDmessages.That leaks basic-auth credentials into agent tool output and logs. Distinct from PR #18 (password form fields in ariaSnapshot/
page.content) and from PRs #16/#20 (navigate/click SSRF allowlists).Trigger
navigatetohttps://user:SECRET@example.com/, then read the command resulturlor a followingsnapshot.url.snapshota page whose anchors resolve tohttps://user:SECRET@…— secret appears inlinks[].hrefandhtmlSnippet.gotowhose Playwright message embeds the credentialed URL.Live Chromium on HEAD a0fabe3 reproduced (1) and (2) before this change.
Fix
packages/runtime/src/url-redact.ts).data:payloads frompage.url()so percent-encoded hrefs cannot hide credentials insnapshot.url.mapCommandFailuremessages.Tests
packages/runtime/src/url-redact.test.tsmapCommandFailureuserinfo casepnpm --filter @webchain/runtime test:coverage(line coverage 94.36%, threshold 90) and live Chromium re-probe after the fix